lib/lockreg.c